using System.Data;
using ET;
namespace DAL
{
    public class LockWarehouse_DAL
    {
        private readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdtb_LockWarehouse(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_LockWarehouse_SelectAll");
        }
        public DataTable BindGirdtb_LockWarehouseDetail()
        {
            cls.CreateNewSqlCommand();
            return cls.GetData("sp_tb_LockWarehouse_Detail");
        }
        public DataTable BindGirdtb_LockWarehouseSelectRow(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@LockWarehouse_ID", id);
            return cls.GetData("sp_tb_LockWarehouse_SelectRow");
        }
        #endregion

        #region Insert
        public bool Inserttb_LockWarehouse(LockWarehouse_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@LockWarehouse_No", data.LockWarehouse_No);
            cls.AddParameter("@LockWarehouse_Date", data.LockWarehouse_Date);
            cls.AddParameter("@LockWarehouse_Note", data.LockWarehouse_Note);
            cls.AddParameter("@LockWarehouse_Test", data.LockWarehouse_Test);
            cls.AddParameter("@LockWarehouse_User_Add", data.LockWarehouse_User_Add);
            cls.AddParameter("@LockWarehouse_Date_Add", data.LockWarehouse_Date_Add);
            cls.AddParameter("@LockWarehouse_Computer_Add", data.LockWarehouse_Computer_Add);
            data.LockWarehouse_ID = cls.ExecuteNonQueryReturnResult("sp_tb_LockWarehouse_Insert", "@ReferenceID");
            return true;
        }
        #endregion

        #region Update
        public bool Updatetb_LockWarehouse(LockWarehouse_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@LockWarehouse_ID", data.LockWarehouse_ID);
            cls.AddParameter("@LockWarehouse_No", data.LockWarehouse_No);
            cls.AddParameter("@LockWarehouse_Date", data.LockWarehouse_Date);
            cls.AddParameter("@LockWarehouse_Note", data.LockWarehouse_Note);
            cls.AddParameter("@LockWarehouse_Test", data.LockWarehouse_Test);
            cls.AddParameter("@LockWarehouse_User_Add", data.LockWarehouse_User_Add);
            cls.AddParameter("@LockWarehouse_Date_Add", data.LockWarehouse_Date_Add);
            cls.AddParameter("@LockWarehouse_Computer_Add", data.LockWarehouse_Computer_Add);
            return cls.ExecuteNonQuery("sp_tb_LockWarehouse_Update");
        }
        #endregion

        #region Delete
        public bool Deletetb_LockWarehouse(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@LockWarehouse_ID", id);
            cls.ExecuteNonQuery("sp_tb_LockWarehouse_DeleteRow");
            return true;
        }
        #endregion
    }
}